<template>
  <div class="content-container" v-show="groupData.data && groupData.data.length">
    <div v-if="groupData.title" class="title">{{ groupData.title }}</div>
    <div class="item-list">
      <div v-for="(item, index) in groupData.data" :key="index" class="con">
        <div class="cover" :class="[{nav_foc: focArr[index]}]">
          <img v-if="item.img" v-lazy="item.img.fhd" :key="item.img.fhd" class="bg" alt>
          <!--<img v-if="item.img" :src="item.img.fhd" class="bg" alt>-->
          <img
            src="../assets/images/imglist_w384/t_bg.png"
            :data-index="'tar_'+group + '_'+index"
            class="t_bg"
          >
          <div class="text">
            <div class="t_move">
              <my-marquee
                :active="focArr[index]"
                align="center"
              >{{ item.name.indexOf('.') ? item.name.split('.')[0] : item.name }}</my-marquee>
            </div>
          </div>
        </div>
        <div class="sub_title">
          <div class="name">{{ item.more && item.more.teacher ? item.more.teacher : '' }}</div>
          <div class="time">{{ item.more && item.more.grade ? item.more.grade : '' }}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import myMarquee from "@/components/base/marquee/marquee";
export default {
  name: "ImgList",
  components: { myMarquee },
  props: {
    groupData: {
      type: Object,
      default: {}
    },
    focArr: {
      type: Array,
      default: []
    },
    group: {
      type: Number,
      default: 0
    }
  }
};
</script>

<style scoped lang="less">
.content-container {
  box-sizing: border-box;
  margin-left: -48px;
  margin-right: -48px;
  .title {
    margin-left: 48px;
    margin-bottom: 35px;
    height: 36px;
    font-family: MicrosoftYaHei;
    font-size: 48px;
    font-weight: normal;
    font-stretch: normal;
    line-height: 36px;
    letter-spacing: 0px;
    color: #a8e7ff;
  }
  .item-list {
    display: flex;
    flex-shrink: 0;
    flex-wrap: wrap;
    .con {
      position: relative;
      margin-left: 48px;
      margin-bottom: 102px;
      width: 384px;
      height: 214px;
      // overflow: hidden;
      border-radius: 8px;
      .cover {
        background-color: #b7b7b7;
        width: 100%;
        height: 100%;
        position: relative;
        overflow: hidden;
        border-radius: 8px;
        .bg {
          position: absolute;
          left: 0px;
          top: 0px;
          width: 384px;
          height: 214px;
          border-radius: 8px;
        }
        .t_bg {
          position: absolute;
          left: 0px;
          top: 158px;
          width: 384px;
          height: 56px;
          background-color: #000000;
          opacity: 0.7;
          border-radius: 8px;
        }
        .text {
          position: absolute;
          left: 14px;
          top: 172px;
          width: 356px;
          height: 30px;
          font-size: 30px;
          font-weight: normal;
          font-stretch: normal;
          line-height: 30px;
          text-align: center;
          color: #ffffff;
        }
      }

      @-webkit-keyframes myScale {
        90% {
          -webkit-transform: scale(1.11);
        }
        100% {
          -webkit-transform: scale(1.1);
        }
      }
      .cover:before {
        content: "";
        background: linear-gradient(
          to right,
          rgba(255, 255, 255, 0) 0,
          rgba(255, 255, 255, 0.6) 50%,
          rgba(255, 255, 255, 0) 100%
        );
        transform: skewX(-25deg);
        height: 100%;
        width: 45%;
        position: absolute;
        top: 0;
        left: -100%;
        z-index: 11;
      }
      .nav_foc {
        border: 2px solid #ffffff;
        border-radius: 8px;
        /*transform: scale(1.1);*/
        /*-webkit-transform: scale(1.1);*/
        -webkit-animation: myScale 100ms;
        -webkit-animation-fill-mode: forwards;
        /*-webkit-animation-delay: 50ms;*/
      }
      .nav_foc:before {
        left: 150%;
        -webkit-transition: left 1000ms ease-in;
      }
    }
    .t_move {
      position: absolute;
      left: 0px;
      top: 0px;
      width: 356px;
      height: 30px;
      overflow: hidden;
      white-space: nowrap;
      // text-overflow: ellipsis;
    }
    .sub_title {
      position: absolute;
      left: 0px;
      top: 238px;
      width: 384px;
      height: 30px;
      .name,
      .time {
        position: absolute;
        left: 0px;
        top: 0px;
        width: 192px;
        height: 30px;
        line-height: 30px;
        font-size: 30px;
        color: #fff;
      }
      .time {
        left: 192px;
        text-align: right;
      }
    }
  }
}
</style>
